#随机选出20%的数据作为测试集，80%的数据作为样本集
import pandas as pd
from sklearn.model_selection import train_test_split

df = pd.read_excel("D:\\A_TXT文件\\sheet.xlsx", sheet_name="Sheet1")
X = df.drop('buy', axis=1)
y = df['buy']
Xtrain, Xtest, Ytrain, Ytest = train_test_split(X, y, test_size=0.2, random_state=666)

print("训练集大小：", len(Xtrain))
print("测试集大小：", len(Xtest))